home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / libmtp8.preinst < prev    next >
Text File  |  2009-10-14  |  2KB  |  64 lines

  1. #!/bin/sh
  2. # preinst script for libmtp
  3.  
  4. set -e
  5.  
  6. PACKAGE=libmtp8
  7.  
  8. # Remove a no-longer used conffile
  9. # Taken from http://wiki.debian.org/DpkgConffileHandling
  10.  
  11. rm_conffile() {
  12.     PKGNAME="$1"
  13.     CONFFILE="$2"
  14.     if [ -e "$CONFFILE" ]; then
  15.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  16.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  17.         if [ "$md5sum" != "$old_md5sum" ]; then
  18.             echo "Obsolete conffile $CONFFILE has been modified by you."
  19.             echo "Saving as $CONFFILE.dpkg-bak ..."
  20.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  21.         else
  22.             echo "Removing obsolete conffile $CONFFILE ..."
  23.             rm -f "$CONFFILE"
  24.         fi
  25.     fi
  26. }
  27.  
  28. # Prepare to move a conffile without triggering a dpkg question
  29. prep_mv_conffile() {
  30.     PKGNAME="$1"
  31.     CONFFILE="$2"
  32.     if [ -e "$CONFFILE" ]; then
  33.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  34.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  35.         if [ "$md5sum" = "$old_md5sum" ]; then
  36.             rm -f "$CONFFILE"
  37.         fi
  38.     fi
  39. }
  40.  
  41. case "$1" in
  42. install|upgrade)
  43.     if dpkg --compare-versions "$2" lt-nl 0.2.6.1-2ubuntu1 ; then
  44.         rm -f /etc/udev/rules.d/libmtp8.rules
  45.         prep_mv_conffile $PACKAGE /etc/udev/libmtp8.rules
  46.     fi
  47.     if dpkg --compare-versions "$2" le 0.3.0-1ubuntu2 ; then
  48.     if [ -e "/etc/udev/rules.d/45-libmtp8.rules" ]; then
  49.         if [ "`md5sum \"/etc/udev/rules.d/45-libmtp8.rules\" | sed -e \"s/ .*//\"`" = \
  50.              "`dpkg-query -W -f='${Conffiles}' $PACKAGE | sed -n -e \"\\\\' /etc/udev/rules.d/45-libmtp8.rules's/.* //p\"`" ]
  51.         then
  52.             rm -f "/etc/udev/rules.d/45-libmtp8.rules"
  53.         fi
  54.     fi
  55.         rm -f /etc/udev/libmtp.rules
  56.         rm -f /etc/udev/libmtp8.rules
  57.     fi
  58.  
  59. esac
  60.  
  61.  
  62.  
  63. exit 0
  64.